#include"Comm.hpp"

int main()
{
    int wfd = open(Path, O_WRONLY);
    if (wfd < 0)
    {
        cout << "open failed ,errno:" << errno << " errstring:" << strerror(errno) << endl;
    }
    // 读取
    string inbuffer;
    while (1)
    {   
        cout<<"请输入要传输的内容# ";
        getline(cin,inbuffer);
        ssize_t n = write(wfd,inbuffer.c_str(),inbuffer.size());
        if (n > 0)
        {
            inbuffer[n] = 0;
            cout << "write success" << endl;
        }
        else
        {
            cout << "write failed ,errno:" << errno << " errstring:" << strerror(errno) << endl;
        }
    }

    return 0;
}